package entity.lianxi.demo05;

import entity.Student;
import java.lang.reflect.Method;
import java.util.Scanner;

public class PinNian {
        public static void main(String[] args) throws Exception {
            Scanner sc = new Scanner(System.in);
            System.out.print("请输入一个年份：");
            int year = sc.nextInt();
            Class<?> clazz = Student.class;
            Method method = clazz.getMethod("isLeapYear", int.class);
            boolean isLeapYear = (boolean) method.invoke(null,year);
            if (isLeapYear) {
                System.out.println(year + " 年是闰年。");
            } else {
                System.out.println(year + " 年是平年。");
            }
        }
}
